#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<unordered_set>
using namespace std;

class Solution{
    public:
    int ans1(vector<int>& nums){
        unordered_set<int> map;
        for(const int& num: nums){
            map.insert(num);
        }
        int m = 0;
        for(const int& num: map){
            if(!map.count(num-1)){
                int currentNum = num;
                int currentStreak = 1;
                while(map.count(currentNum+1)){
                    currentNum++;
                    currentStreak++;
                }
                m = max(m, currentStreak);
            }
        }
        return m;
    }
    

};

void test1(){
    Solution s;
    vector<int> nums = {100,4,200,1,3,2};
    int ret = s.ans1(nums);
    cout << ret << endl;
}

void test2(){
    Solution s;
    vector<int> nums = {0,3,7,2,5,8,4,6,0,1};
    int ret = s.ans1(nums);
    cout << ret << endl;
}

void test3(){
    Solution s;
    vector<int> nums = {1,2,3,1,2,3};
    int target = 2;
    int ret = s.ans1(nums);
    cout << ret << endl;
}

int main(void){
    test1();
    test2();
    test3();

    return 0;
}